load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_library")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

idl_generator(
    name = "add_shard_coordinator_document_gen",
    src = "add_shard_coordinator_document.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/global_catalog/ddl:sharding_ddl_coordinator_gen",
    ],
)

idl_generator(
    name = "remove_shard_commit_coordinator_document_gen",
    src = "remove_shard_commit_coordinator_document.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/global_catalog/ddl:sharding_ddl_coordinator_gen",
        "//src/mongo/db/sharding_environment:sharding_types_gen",
    ],
)

idl_generator(
    name = "remove_shard_draining_progress_gen",
    src = "remove_shard_draining_progress.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
    ],
)

idl_generator(
    name = "transition_to_sharded_cluster_gen",
    src = "transition_to_sharded_cluster.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

idl_generator(
    name = "add_shard_gen",
    src = "add_shard.idl",
    deps = [
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/global_catalog:type_shard_identity_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

idl_generator(
    name = "remove_shard_gen",
    src = "remove_shard.idl",
    deps = [
        ":remove_shard_draining_progress_gen",
        "//src/mongo/db:basic_types_gen",
        "//src/mongo/db/sharding_environment:sharding_types_gen",
        "//src/mongo/idl:generic_argument_gen",
    ],
)

mongo_cc_library(
    name = "remove_shard_exception",
    srcs = [
        "remove_shard_exception.cpp",
        ":remove_shard_draining_progress_gen",
    ],
    deps = [
        "//src/mongo/db:server_base",
    ],
)
